# Game server
simple game server written in python

## how to run
setup env variables
- `SERVER_IP` - set to "0.0.0.0" or it'll be on localhost
- `SERVER_PORT` - server port (default "1215")
- `SERVER_RECV_SIZE` - max size of packet (int kbytes, default 10)
- `SERVER_AFK_TIME` - time before afk player kick (int seconds, default 60)
- `SERVER_MAX_PLAYERS` - max amount of players in one moment (int, default 166)

run
`./server.py`

## usage
send to server by udp json with player name and some data
server will send data of all players

to delete player from server list send "delete" key with any data
if player is not active he'll be also deleted

### example
```json
send to server:
{
    "name": "fwe",
    "x": 1,
    "y": 2,
}

get from server:
[
    {
        "name": "fwe"
        "x": 1,
        "y": 2
    },
    ...
]

send to server:
{
    "delete": 1
}

get from server:
[...]
```
